package com.miaosha.ms_05.dao;

import com.miaosha.ms_05.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Description //TODO
 * @Author Administrator
 * @DATE 2020/9/13 17:00
 **/
@Mapper
public interface UserDao {

    @Select("SELECT * FROM user WHERE id = #{id}")
    User getUserById(String id);


    @Insert("insert into user(id, nickname, password) values (#{user.id}, #{user.nickName}, #{user.password})")
    @SelectKey(keyColumn="id", keyProperty="id", resultType=long.class, before=false, statement="select last_insert_id()")
    int insert(@Param("user") User user);

    @Delete("DELETE FROM user")
    void delete();
}
